import store from "@/store"

export default function checkPermission(value) {
  if (value && value instanceof Array && value.length > 0) {
    const permissions = store.getters && store.getters.permissions
    return permissions.some(permission => {
      return permission === "*" || value.includes(permission)
    })
  } else {
    console.error(`need permission! ['add','edit']`)
    return false
  }
}
